package cn.iwoo.svn.actions;

import java.io.File;

import org.eclipse.jface.action.Action;
import org.tigris.subversion.svnclientadapter.SVNRevision;

import cn.iwoo.svn.util.SVNRepositoryInfo;
import cn.iwoo.svn.util.SVNRepositoryUtil;

public class SVNCheckoutAction extends Action {
	private static final String ID = "cn.iwoo.svn.actions.SVNCheckoutAction";

	public SVNCheckoutAction() {
		this.setId(ID);
		this.setText("Checkout");
		this.setToolTipText("Checkout");
	}

	@Override
	public void run() {
		SVNRepositoryInfo repositoryInfo = this.createRepositoryInfo();
		try {
			SVNRepositoryUtil.getInstance().checkout(repositoryInfo, "temp.withsvn", new File("C:/A/B/C"), SVNRevision.HEAD, true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public SVNRepositoryInfo createRepositoryInfo() {
		SVNRepositoryInfo repositoryInfo = new SVNRepositoryInfo();
		repositoryInfo.setUrl("http://iwoo.googlecode.com/svn/trunk/");
		//		repositoryInfo.setUserName("linguo@JEHUISOFT");
		//		repositoryInfo.setPassword("Jehui110");
		return repositoryInfo;
	}
}
